package com.self.io;

import com.sun.jmx.mbeanserver.MXBeanMappingFactory;

import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class SeqIO {

    public static void main(String[] args) {

        File file = new File("orders");
        if(!file.exists()) {

            try {

                boolean success = file.createNewFile();
                if(success) {
                    System.out.println("创建文件[orders]成功");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        try {

            Path path = Paths.get(file.getAbsolutePath());

            FileChannel fileChannel = FileChannel.open(path, StandardOpenOption.READ,StandardOpenOption.WRITE);
            MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE,0,1024*102*10);
            mappedByteBuffer.load();


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
